package dtmc;

import java.util.Scanner;

public class T3 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] array = new int[n];
        for (int i=0; i<n; i++) {
            array[i] = i+1;
        }
        swap(array, n-2, k-1);

        for (int i : array) {
            System.out.print(i + " ");
        }
    }
    public static void swap(int[] array, int i, int j) {
        int temp = array[i];
        array[i] = array[j];
        array[j] =temp;
    }
}
